#!/bin/sh
DWT_INSTALL_PATH="/opt/dynamsoft/Dynamic Web TWAIN Service 19"
#start service
while :
do

PROXY_NUM=`ps aux | grep "${DWT_INSTALL_PATH}/DynamsoftScanning proxy" | grep -v "grep" | wc -l` 

if [ $PROXY_NUM -eq 0 ]; then
	"${DWT_INSTALL_PATH}/DynamsoftScanning" proxy&
fi

ENUMSOURCE_NUM=`ps aux | grep "${DWT_INSTALL_PATH}/DynamsoftScanning enumSource" | grep -v "grep" | wc -l` 

if [ $ENUMSOURCE_NUM -eq 0 ]; then
	"${DWT_INSTALL_PATH}/DynamsoftScanning" enumSource&
fi

sleep 2s
done

